function sx() {
    window.location = 'feedbackList.html';
}


var feedbackManagementtableI = null;
function  feedbackManagementtableRefre(){
    feedbackManagementtableI.reload('feedbackManagementtableId');
}
layui.use(['table', 'laydate','form'], function(){
        var table = layui.table,
        laydate = layui.laydate,
        form = layui.form;

        laydate.render({
                elem: '#rq', //指定元素
        });


    feedbackManagementtableI = table.render({
                elem: '#test',
                url:'/feedbackManagement/getAll',
                id:'feedbackManagementtableId',
                page:{
                    layout:['count','prev','page','next','limit'],
                    groups:2,
                    limit:10,
                    limits:[10,15,20]

                },
                cols: [[
                        {type: 'checkbox',width: 50},
                        {field:'feedbackListId', width: 70, title: '序号'},
                        {field:'feedbackUserAccount', width: 200, title: '用户账号',align:'center'},
                        {field:'feedbackListType', width: 150, title: '意见反馈类型',align:'center'},
                        {field:'feedbackListClassification', width: 150, title: '意见分类',align:'center'},
                        {field:'feedbackListTime', title: '反馈时间',  width: 250,align:'center'},
                        {field:'feedbackListContent', title: '反馈内容',  width: 280,align:'center'},
                        {fixed: '', title:'操作', toolbar: '#barDemo',minWidth:200,align:'center'}
                ]],
                toolbar:'#toolbarDemo',
                skin: 'line',
                parseData:function (res){
                        return{
                                "code":res.code, // 解析接口状态
                                "msg": res.msg, // 解析提示文本
                                "count": res.count, // 解析总条数
                                "data": res.data // 解析数据列表
                        };
                }
        });

        table.on('tool(test)', function(obj){ // 双击 toolDouble
                data = obj.data;
                //console.log(obj)
            if(obj.event === 'sl'){
                layer.open({
                    type:2,
                    title:'受理详情',
                    content:'acceptance.html',
                    area:['950px','650px'],
                    offset: ['170px', '300px'],
                    success:function (layero,index){
                        var bo = layer.getChildFrame('body',index);

                        bo.find('span[name="feedbackListId"]').text(data.feedbackListId);
                        bo.find('input[name="feedbackUserAccount"]').val(data.feedbackUserAccount);
                        bo.find('input[name="feedbackListType"]').val(data.feedbackListType);
                        bo.find('input[name="feedbackListClassification"]').val(data.feedbackListClassification);
                        bo.find('input[name="feedbackListTime"]').val(data.feedbackListTime);
                        bo.find('textarea[name="feedbackListContent"]').val(data.feedbackListContent);
                    }
                })
            }

        });

        form.on('submit(go)',function (d){
                d = d.field;
                console.log(d);
                table.reload('feedbackManagementtableId',{
                        where:{
                            feedbackUserAccount:d.feedbackUserAccount,
                            feedbackListType:d.feedbackListType,
                            feedbackListClassification:d.feedbackListClassification,
                            feedbackListTime:d.feedbackListTime
                        }
                });
        })

    $.ajax({
        type:"post",
        url:'/feedbackManagement/span1',
        data: {"span1":0},
        dataType:'json',
        success:function (res) {
            if (res.state == 200){
                $("#span1").text(res.num);
            }
        },
        error:function(e){
            console.log("异常");

        }

    })

    $.ajax({
        type:"post",
        url:'/feedbackManagement/span2',
        data: {"span1":1},
        dataType:'json',
        success:function (res) {
            if (res.state == 200){
                $("#span2").text(res.num);
            }

        },
        error:function(e){
            console.log("异常");

        }

    })

    $("#dsh").click(function () {
        // alert("aaa");
        $(this).addClass("check");
        $("#ysl").removeClass("check");
        table.reload('feedbackManagementtableId',{
            where:{
                sorw:0
            }
        });

    })

    $("#ysl").click(function () {
        // alert("aaa");
        $(this).addClass("check");
        $("#dsh").removeClass("check");
        $("#dsh").css("background-color","");

        table.reload('feedbackManagementtableId',{
            where:{
                sorw:1
            }
        });
    })

});
